using System;
using System.Data;
using Utils;
using Utils.DatabaseUtils;


namespace QLCG.DAO
{
public class tblHocViUI
{ 
	private int idHocVi;
	public int IdHocVi
	{
		get { return idHocVi;}
		set { idHocVi = value;}
	}

	private int idChuyenGia;
	public int IdChuyenGia
	{
		get { return idChuyenGia;}
		set { idChuyenGia = value;}
	}

	private String tenHocVi;
	public String TenHocVi
	{
		get { return tenHocVi;}
		set { tenHocVi = value;}
	}

	private String mota;
	public String Mota
	{
		get { return mota;}
		set { mota = value;}
	}

	public tblHocViUI() {}

	public tblHocViUI(int idHocVi, int idChuyenGia, String tenHocVi, String mota)
	 {
		this.idHocVi = idHocVi;
 		this.idChuyenGia = idChuyenGia;
 		this.tenHocVi = tenHocVi;
 		this.mota = mota;
 	}

	public int Add(int idChuyenGia, String tenHocVi, String mota)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblHocVi_Add",idChuyenGia,tenHocVi,mota);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Update(int idHocVi, int idChuyenGia, String tenHocVi, String mota)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblHocVi_Update",idHocVi,idChuyenGia,tenHocVi,mota);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Delete(int idHocVi)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblHocVi_Delete",idHocVi);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int DeleteAll()
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblHocVi_DeleteAll");
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public DataSet Get(int idHocVi)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblHocVi_Get",idHocVi);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetAll()
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblHocVi_GetAll");
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetByIdChuyenGia(int idChuyenGia)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblHocVi_GetByIdChuyenGia",idChuyenGia);
			return result;
		}
		catch(Exception e) {return null; }
	}

} 
}
